<!DOCTYPE html>
<html xmlns:th="http://www.thymeleaf.org">
<head>
    <meta charset="UTF-8">
    <title>菜品类别编辑</title>
    <link href="https://cdn.bootcss.com/twitter-bootstrap/3.0.1/css/bootstrap.css" rel="stylesheet">
    <link rel="stylesheet" th:href="@{/layui/css/layui.css}">
    <i th:replace="~{common :: baseUrl}"></i>
</head>
<body>
<form class="layui-form layui-form-pane" action=""  lay-filter="example">



    <div class="layui-form-item">
        <label class="layui-form-label">客户名称</label>
        <div class="layui-input-inline">
            <select name="clientId" id="clientId"   lay-verify="required">
                <option value="">请选择</option>
                <option th:each="f : ${orderClientList}"  th:value="${f.id}" th:text="${f.name}" ></option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">服装名称</label>
        <div class="layui-input-inline">
            <select name="clothingId" id="clothingId"  lay-verify="required"  >
                <option value="">请选择</option>
                <option th:each="f : ${clothingList}"  th:value="${f.id}" th:text="${f.name}" ></option>
            </select>
        </div>
    </div>


    <div class="layui-form-item">
        <label class="layui-form-label">订购数量</label>
        <div class="layui-input-inline">
            <input type="text" name="orderNum" lay-verify="number"   placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>




    <div class="layui-form-item">
        <label class="layui-form-label">单价</label>
        <div class="layui-input-inline">
            <input type="text" name="unitPrice"   lay-verify="number" placeholder="请输入" autocomplete="off" class="layui-input">
        </div>
    </div>



    <div class="layui-form-item" pane="">
        <label class="layui-form-label">订单状态</label>
        <div class="layui-input-block">
            <input type="radio" name="status" value="1" title="未开始" checked>
            <input type="radio" name="status" value="2" title="准备中" disabled>
            <input type="radio" name="status" value="3" title="已开始" disabled>
            <input type="radio" name="status" value="4" title="已结束" disabled>
            <input type="radio" name="status" value="0" title="订单取消"  disabled>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">订购时间</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="orderDate"   lay-verify="required" id="orderDate" placeholder="yyyy-MM-dd HH:mm:ss">
            </div>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-inline">
            <label class="layui-form-label">要求日期</label>
            <div class="layui-input-inline">
                <input type="text" class="layui-input" name="requireDate"  lay-verify="required" id="requireDate" placeholder="yyyy-MM-dd HH:mm:ss">
            </div>
        </div>
    </div>

    <div class="layui-form-item layui-form-text">
        <label class="layui-form-label">订单要求</label>
        <div class="layui-input-block">
            <textarea placeholder="请输入内容" name="example" lay-verify="required" class="layui-textarea"></textarea>
        </div>
    </div>

    <div class="layui-form-item">
        <div class="layui-input-block">
            <button type="submit" class="layui-btn" lay-submit="" lay-filter="sub">立即提交</button>
            <button type="reset" class="layui-btn layui-btn-primary">重置</button>
        </div>
    </div>

</form>



</body>
<script th:src="@{/layui/layui.js}"></script>
<script th:inline="none">
    //JavaScript代码区域
    layui.use(['element','form','upload','layer','laydate'], function() {
        var element = layui.element;
        var form = layui.form;
        var upload = layui.upload;
        var layer = layui.layer;
        var laydate = layui.laydate;
        var $ = layui.$;


        //日期时间选择器
        laydate.render({
            elem: '#orderDate'
            ,type: 'datetime'
        });
        //日期时间选择器
        laydate.render({
            elem: '#requireDate'
            ,type: 'datetime'
        });



        //提交
        form.on('submit(sub)', function(data){

            //发送ajax请求  编辑APP信息
            $.ajax({
                url:baseUrl+"order/order/add",
                data:data.field,
                type:"post",
                dataType:"json",
                success:function (result) {
                    if (result.code==0){
                        layer.open({
                            title: '添加订单信息'
                            ,content: '添加成功！'
                            ,end:function () {
                                //当你在iframe页面关闭自身时
                                var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                                parent.layer.close(index); //再执行关闭
                            }
                        });
                    }else {
                        layer.open({
                            title: '编辑菜品信息'
                            ,content: result.msg
                        });
                    }
                },
                error:function () {
                    layer.msg("服务器原地爆炸,请联系管理员!!!");
                }
            })
            return false; //阻止表单跳转。如果需要表单跳转，去掉这段即可。

        });





    });

</script>
</html>